package com.xjc.market.frame.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.support.RequestContext;

/**
 * 
 * @author HanqingLiu
 *
 */
public class Mytag4i18n extends BodyTagSupport{
	
	private static final long serialVersionUID = 1L;
	
	private String key;
	
	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}

	public int doStartTag(){
		try {
			/*HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
			RequestContext requestContext = new RequestContext(request);
			String message = requestContext.getMessage(key);
			pageContext.getOut().write(message);*/
			return SKIP_BODY;
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return SKIP_BODY;
	}
	
	public int doEndTag(){
        return  EVAL_BODY_INCLUDE;
	}
	
	public static java.lang.String message(java.lang.String key){
		try {
			/*
			HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
			RequestContext requestContext = new RequestContext(request);
			String message = requestContext.getMessage(key);*/
			return "";
		}catch(Exception e){
			e.printStackTrace();
		}
		return "";
	}
}
